package com.example.hrdemo.module.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.hrdemo.module.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.math.BigInteger;
import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<User> {

    //获取表内总行数
//    @Select("SELECT COUNT(*) FROM user;")
//    Integer getUserCount();



    //获取所有员工的信息
//    @Select("select * from user WHERE is_deleted=0")
//    List<User> getAll();

    //获取所有员工的信息--模糊查询+分页
   // @Select("select * from user WHERE is_deleted=0 ORDER BY id LIMIT #{offset},#{pageSize} ")
//    List<User> getAllPage(@Param("keyword") String keyword,
//                          @Param("pageSize") Integer pageSize,
//                          @Param("offset") Integer offset);

    //获取一个员工的信息
//    @Select("select * from user WHERE id=#{id} and is_deleted=0")
//    User getById(@Param("id")BigInteger id);

    //获取一条数据
//    @Select("select * from user WHERE id=#{id}")
//    User extractById(@Param("id")BigInteger id);

    //新增一名员工
//    int insert(@Param("user") User user);

    //修改员工信息
//    int update(@Param("user") User user);

    //删除一名员工(逻辑删除）
//    @Update("update user set is_deleted=1, update_time=#{time} where id = #{id} limit 1")
//    int delete(@Param("id") BigInteger id, @Param("time") Integer time);

}
